import History from "./base";

export default class HTML5History extends History {
  constructor(router) {
    super(router);
    console.log(this.router);
  }

  getCurrentLocation() {
    return window.location.pathname; // 获取路径
  }

  setupListener() {
    window.addEventListener("popstate", () => {
      this.transitionTo(window.location.pathname);
    });
  }

  pushState(location) {
    history.pushState({}, null, location);
  }
}
